//wp_dlg_init.sqf
#include "ACV_constantes.h"
#include "ACV_ID_wp_dlg.h"
ACV_FNCT_FillWpCb = {
	_control = _this select 0;
	_arr = _this select 1;
	_selected = _this select 2;
	_n = 0;
	lbClear _control;
	{
		_idx = _control lbAdd (_x select 1);
		_control lbSetData [_idx, (_x select 0)];
		if ((_x select 0) == _selected) then {
			_control lbSetCurSel _idx;
		};
	} foreach _arr;
};
disableSerialization;
_display = uiNamespace getVariable "R3F_ACV_WP_DLG";
_cb_wp = _display displayCtrl ACV_DLG_ID_WP_Type;
_cb_mode_combat = _display displayCtrl ACV_DLG_ID_WP_Combat;
_cb_formation = _display displayCtrl ACV_DLG_ID_WP_Formation;
_cb_speed = _display displayCtrl ACV_DLG_ID_WP_Vitesse;
_cb_behaviour = _display displayCtrl ACV_DLG_ID_WP_Comportement;
_ed_placement = _display displayCtrl ACV_DLG_ID_WP_Placement;
_ed_achevement = _display displayCtrl ACV_DLG_ID_WP_Achevement;
_ed_min = _display displayCtrl ACV_DLG_ID_WP_Min;
_ed_moy = _display displayCtrl ACV_DLG_ID_WP_Moy;
_ed_max = _display displayCtrl ACV_DLG_ID_WP_Max;
_ed_script = _display displayCtrl ACV_DLG_ID_WP_Script;
_ed_condition = _display displayCtrl ACV_DLG_ID_WP_Condition;

[_cb_wp,ACV_WAYPOINTARRAY,ACV_Default_WP_Type] call ACV_FNCT_FillWpCb;
[_cb_mode_combat,ACV_WP_MODE_COMBAT,ACV_Default_WP_Combat] call ACV_FNCT_FillWpCb;
[_cb_formation,ACV_WP_FORMATION,ACV_Default_WP_Formation] call ACV_FNCT_FillWpCb;
[_cb_speed,ACV_WP_SPEED,ACV_Default_WP_Speed] call ACV_FNCT_FillWpCb;
[_cb_behaviour,ACV_WP_BEHAVIOUR,ACV_Default_WP_Behaviour] call ACV_FNCT_FillWpCb;

_ed_placement ctrlSetText ACV_Default_WP_Placement;
_ed_achevement ctrlSetText ACV_Default_WP_Achevement;
_ed_min ctrlSetText ACV_Default_WP_Delai_Min;
_ed_moy ctrlSetText ACV_Default_WP_Delai_Moy;
_ed_max ctrlSetText ACV_Default_WP_Delai_Max;

if (ACV_DLG_RET != 1) then {
	_ed_script ctrlSetText (ACV_Default_WP_Script select 1);
	_ed_condition ctrlSetText (ACV_Default_WP_Script select 0);
} else {
	_ed_script ctrlSetText "";
	_ed_condition ctrlSetText "true";
};
((findDisplay ACV_DLG_ID_WP_Dlg) displayCtrl ACV_DLG_ID_WP_Type) ctrlSetTooltip localize "STR_TOOLTIP_WP_TYPE";
((findDisplay ACV_DLG_ID_WP_Dlg) displayCtrl ACV_DLG_ID_WP_Combat) ctrlSetTooltip localize "STR_TOOLTIP_WP_COMBAT";
((findDisplay ACV_DLG_ID_WP_Dlg) displayCtrl ACV_DLG_ID_WP_Formation) ctrlSetTooltip localize "STR_TOOLTIP_WP_FORM";
((findDisplay ACV_DLG_ID_WP_Dlg) displayCtrl ACV_DLG_ID_WP_Vitesse) ctrlSetTooltip localize "STR_TOOLTIP_WP_SPEED";
((findDisplay ACV_DLG_ID_WP_Dlg) displayCtrl ACV_DLG_ID_WP_Comportement) ctrlSetTooltip localize "STR_TOOLTIP_WP_BEHAVIOR";
((findDisplay ACV_DLG_ID_WP_Dlg) displayCtrl ACV_DLG_ID_WP_Placement) ctrlSetTooltip localize "STR_TOOLTIP_WP_PLACEMENT";
((findDisplay ACV_DLG_ID_WP_Dlg) displayCtrl ACV_DLG_ID_WP_Achevement) ctrlSetTooltip localize "STR_TOOLTIP_WP_ACHEVEMENT";
((findDisplay ACV_DLG_ID_WP_Dlg) displayCtrl ACV_DLG_ID_WP_Min) ctrlSetTooltip localize "STR_TOOLTIP_WP_MIN";
((findDisplay ACV_DLG_ID_WP_Dlg) displayCtrl ACV_DLG_ID_WP_Moy) ctrlSetTooltip localize "STR_TOOLTIP_WP_MOY";
((findDisplay ACV_DLG_ID_WP_Dlg) displayCtrl ACV_DLG_ID_WP_Max) ctrlSetTooltip localize "STR_TOOLTIP_WP_MAX";
((findDisplay ACV_DLG_ID_WP_Dlg) displayCtrl ACV_DLG_ID_WP_Condition) ctrlSetTooltip localize "STR_TOOLTIP_WP_CONDITION";
((findDisplay ACV_DLG_ID_WP_Dlg) displayCtrl ACV_DLG_ID_WP_Script) ctrlSetTooltip localize "STR_TOOLTIP_WP_SCRIPT";